<template>
  <div>
    新闻详情页
    {{ id }}
    {{ title }}
  </div>
</template>
<script>
  export default {
    head() {
      return {
        title: this.title,
        meta: [
          { hid: 'description', name: 'description', content: 'My custom description' },
          { hid: 'keywords', name: 'keywords', content: 'My custom keywords' },
        ]
      }
    },
    data() {
      return {
        id: '',
        title: '',
        newsList: [
          {id: 1, title: ' 我国时速200公里级高速公路及磁浮汽车技术首次测试'},
          {id: 2, title: '美国加州发布能源紧急警报，敦促居民减少电力使用'},
          {id: 3, title: '百度副总裁：单靠平台在智能化进程中无法通吃'},
          {id: 4, title: '英特尔将在印度设立半导体芯片制造厂'},
          {id: 5, title: '工信部发声！5000亿赛道火了，多股暴涨'},
          {id: 6, title: '马斯克把水搅混 推特律师反击 收购官司何时开庭'}
        ]
      }
    },
    created() {
      this.id = this.$route.params.id
      // let arr = this.newsList.filter(item => {
      //   return item.id == this.id
      // })
      
      let obj = this.newsList.find(item => {
        return item.id == this.id
      })
      this.title = obj.title
    }
  }
</script>